ditto
struct Foo {} enum msg = isRandomAccessRangeErrorFormatter!(Foo); enum exp =`Foo is not an RandomAccessRange because the property 'empty' does not exist and the property 'front' does not exist and the function 'popFront' does not exist and the property 'save' does not exist and must allow for array indexing, aka. [] access`; static assert(msg == exp, "\n" ~ msg ~ "\n" ~ exp); string msg2 = isRandomAccessRangeErrorFormatter!(Foo); assert(msg2 == exp, "\n" ~ msg ~ "\n" ~ exp);
ditto
struct Foo { int empty; } enum msg = isRandomAccessRangeErrorFormatter!(Foo); enum exp = `Foo is not an RandomAccessRange because the property 'empty' is not of type 'bool' but 'int' and the property 'front' does not exist and the function 'popFront' does not exist and the property 'save' does not exist and must allow for array indexing, aka. [] access`; static assert(msg == exp, msg ~ "\n" ~ exp); string msg2 = isRandomAccessRangeErrorFormatter!(Foo); assert(msg2 == exp, msg ~ "\n" ~ exp);
ditto
struct Foo { bool empty; void front(); } enum msg = isRandomAccessRangeErrorFormatter!(Foo); enum exp =`Foo is not an RandomAccessRange because the property 'front' does not return a non 'void' value and the function 'popFront' does not exist and the property 'save' does not exist and must allow for array indexing, aka. [] access`; static assert(msg == exp, msg ~ "\n" ~ exp); string msg2 = isRandomAccessRangeErrorFormatter!(Foo); assert(msg2 == exp, msg ~ "\n" ~ exp);
ditto
struct Foo { bool empty; int front(); } enum msg = isRandomAccessRangeErrorFormatter!(Foo); enum exp =`Foo is not an RandomAccessRange because the function 'popFront' does not exist and the property 'save' does not exist and must allow for array indexing, aka. [] access`; static assert(msg == exp, msg ~ "\n" ~ exp); string msg2 = isRandomAccessRangeErrorFormatter!(Foo); assert(msg2 == exp, msg ~ "\n" ~ exp);
ditto
struct Foo { bool empty; int front(); void popFront(); float back(); } enum msg = isRandomAccessRangeErrorFormatter!(Foo); enum exp =`Foo is not an RandomAccessRange because the property 'save' does not exist and must allow for array indexing, aka. [] access`; static assert(msg == exp, "\n" ~ msg ~ "\n" ~ exp); string msg2 = isRandomAccessRangeErrorFormatter!(Foo); assert(msg2 == exp, "\n" ~ msg ~ "\n" ~ exp);
ditto
struct Foo { enum empty = true; int front(); void popFront(); float back(); } enum msg = isRandomAccessRangeErrorFormatter!(Foo); enum exp =`Foo is not an RandomAccessRange because the property 'save' does not exist and must allow for array indexing, aka. [] access`; static assert(msg == exp, "\n" ~ msg ~ "\n" ~ exp); string msg2 = isRandomAccessRangeErrorFormatter!(Foo); assert(msg2 == exp, "\n" ~ msg ~ "\n" ~ exp);
ditto
struct Foo { enum empty = true; int front(); void popFront(); float back(); Foo save() { return this; } } enum msg = isRandomAccessRangeErrorFormatter!(Foo); enum exp =`Foo is not an RandomAccessRange because must allow for array indexing, aka. [] access`; static assert(msg == exp, "\n" ~ msg ~ "\n" ~ exp); string msg2 = isRandomAccessRangeErrorFormatter!(Foo); assert(msg2 == exp, "\n" ~ msg ~ "\n" ~ exp);
ditto
struct Foo { enum empty = true; int front(); void popFront(); float back(); Foo save() { return this; } int opIndex(size_t idx) { return 0; } size_t length() { return 0; } } enum msg = isRandomAccessRangeErrorFormatter!(Foo); enum exp =`Foo is an RandomAccessRange`; static assert(msg == exp, "\n" ~ msg ~ "\n" ~ exp); string msg2 = isRandomAccessRangeErrorFormatter!(Foo); assert(msg2 == exp, "\n" ~ msg ~ "\n" ~ exp);
This function produces a descriptive message why R is not a RandomAccessRange. If R is an RandomAccessRange the returned string will say so.